<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7 lt8"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8 lt8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="UTF-8" />
        <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  -->
        <title>我的特約廠商(管理模式)</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
        <meta name="description" content="Login and Registration Form with HTML5 and CSS3" />
        <meta name="keywords" content="html5, css3, form, switch, animation, :target, pseudo-class" />
        <meta name="author" content="Codrops" />
        <link rel="shortcut icon" href="../favicon.ico"> 
        <link rel="stylesheet" type="text/css" href="css/demo.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />
		<link rel="stylesheet" type="text/css" href="css/animate-custom.css" />
<script type="text/javascript" src="myjs/md5.js"></script>
<?php
	session_save_path("./.php_session");
	session_start();
	if(isset($_SESSION["login"]) && $_SESSION["login"] == true) {
		echo "<script>document.location.href=(\"topframe.php\")</script>";
	}
?>
<script lang=javascript>
function antiBot()
{
    var maxNum = 9;  
    var minNum = 1;  
    var n1 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
    var n2 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
	var p1=document.getElementById("username");
	var p2=document.getElementById("passwd");
	if((p1.value.length == 0) || (p2.value.length == 0))
		return false;
    var ans=prompt("請問這個算式的答案是多少 " + n1 +" * " + n2 +" ?");
    if(ans != n1*n2) {
		alert("Wrong answer");
		window.open("comp_admin.php");
	}
	var hash = hex_md5(document.getElementById("passwd").value);
	document.getElementById("passwd").value = hash;
	//alert(document.getElementById("passwd").value);
}
function antiBot2()
{
    var maxNum = 9;  
    var minNum = 1;  
    var n1 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
    var n2 = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;  
	var p0=document.getElementById("usernamesignup");
	var p1=document.getElementById("passwordsignup");
	var p2=document.getElementById("passwordsignup_confirm");
	if((p0.value.length ==0) || (p1.value.length == 0) || (p2.value.length == 0))
		return false;
	if(p1.value != p2.value) {
		alert('password is not consistent');
		p2.value="";
		return false;
	}
    var ans=prompt("請問這個算式的答案是多少 " + n1 +" * " + n2 +" ?");
    if(ans != n1*n2) {
		alert("Wrong answer");
		window.open("comp_admin.php");
	}
	var hash = hex_md5(p1.value);
	p1.value = hash;
	//alert(document.getElementById("passwd").value);
	
}
</script>
    </head>
    <body>
        <div class="container">
            <!-- Codrops top bar -->
			<!--
            <div class="codrops-top">
                <a href="">
                    <strong>&laquo; Previous Demo: </strong>Responsive Content Navigator
                </a>
                <span class="right">
                    <a href=" http://tympanus.net/codrops/2012/03/27/login-and-registration-form-with-html5-and-css3/">
                        <strong>Back to the Codrops Article</strong>
                    </a>
                </span>
                <div class="clr"></div>
            </div>
			-->
            <header>
                <h1>歡迎使用 <span>我的特約廠商 </span></h1> 
				管理模式
				<?php
					if(isset($_GET['err'])) {
						$msg = htmlspecialchars($_GET['err']);
						echo "<font color=red><b>$msg</b></font>";
					}
				?>
				<!--
				<nav class="codrops-demos">
					<span>Click <strong>"Join us"</strong> to see the form switch</span>
					<a href="index.html" class="current-demo">Demo 1</a>
					<a href="index2.html">Demo 2</a>
					<a href="index3.html">Demo 3</a>
				</nav>
				-->
            </header>
            <section>				
                <div id="container_demo" >
                    <!-- hidden anchor to stop jump http://www.css3create.com/Astuce-Empecher-le-scroll-avec-l-utilisation-de-target#wrap4  -->
                    <a class="hiddenanchor" id="toregister"></a>
                    <a class="hiddenanchor" id="tologin"></a>
                    <div id="wrapper">
                        <div id="login" class="animate form">
                            <form  action="login.php" autocomplete="on"> 
                                <h1>登入</h1> 
                                <p> 
                                    <label for="username" class="uname" data-icon="u" > 使用者名稱 </label>
                                    <input id="username" name="uname" required="required" type="text" placeholder="myusername or mymail@mail.com"/>
                                </p>
                                <p> 
                                    <label for="password" class="youpasswd" data-icon="p"> 密碼 </label>
                                    <input id="passwd" name="passwd" required="required" type="password" placeholder="eg. X8df!90EO" /> 
                                </p>
								<!--
                                <p class="keeplogin"> 
									<input type="checkbox" name="loginkeeping" id="loginkeeping" value="loginkeeping" /> 
									<label for="loginkeeping">Keep me logged in</label>
								</p>
								-->
                                <p class="login button"> 
                                    <input type="submit" value="登入" onclick='antiBot();'/> 
								</p>
                                <p class="change_link">
									沒有帳號 ?
									<a href="#toregister" class="to_register">立即註冊</a>
									<a href="index.php" class="to_register">瀏覽模式</a>
								</p>
                            </form>
                        </div>

                        <div id="register" class="animate form">
                            <form  action="signup.php" autocomplete="on"> 
                                <h1> 註冊新帳號 </h1> 
                                <p> 
                                    <label for="usernamesignup" class="uname" data-icon="u">使用者名稱</label>
                                    <input id="usernamesignup" name="usernamesignup" required="required" type="text" placeholder="mysuperusername690" />
                                </p>
								<!--
                                <p> 
                                    <label for="emailsignup" class="youmail" data-icon="e" > Your email</label>
                                    <input id="emailsignup" name="emailsignup" required="required" type="email" placeholder="mysupermail@mail.com"/> 
                                </p>
								-->
                                <p> 
                                    <label for="passwordsignup" class="youpasswd" data-icon="p">密碼 </label>
                                    <input id="passwordsignup" name="passwordsignup" required="required" type="password" placeholder="eg. X8df!90EO"/>
                                </p>
                                <p> 
                                    <label for="passwordsignup_confirm" class="youpasswd" data-icon="p">請再輸入一次 </label>
                                    <input id="passwordsignup_confirm" name="passwordsignup_confirm" required="required" type="password" placeholder="eg. X8df!90EO"/>
                                </p>
                                <p class="signin button"> 
									<input type="submit" value="立即註冊" onclick='antiBot2();'/> 
								</p>
                                <p class="change_link">  
									已經有帳號 ?
									<a href="#tologin" class="to_register"> 登入 </a>
								</p>
                            </form>
                        </div>
						
                    </div>
                </div>  
            </section>
        </div>
    </body>
</html>
